﻿@using Janus.Mes.WebClient;
@using Janus.BaseEntitys;
@using Janus.Mes.VO;
@model SysDictionaryVO
@{
    Layout = null;
    var subSysDics = Model.SubDics ?? new List<SysDictionaryVO>();
    int i = 0;
    int j = 0;
    int tab = 100;
}
<div class="pageContent enableEnterToTab">
    <form method="post" action="System/SysDictionary/create?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
          onsubmit="return validateCallback(this, dialogAjaxDone);">
        @Html.ValidationSummary(true)
        <div class="pageFormContent">
            <input id="hidIsCreate" name="hidIsCreate" type="hidden" value="@ViewBag.IsCreate" />
            <p>
                <label>
                    分组名：
                </label>
                @if (ViewBag.IsCreate == true)
                {
                    @Html.TextBoxFor(m => m.GroupName, new { @class = "required IsExisted", ajax = "System/SysDictionary/IsGroupNameExist" })
                }
                else
                {
                    @Html.TextBoxFor(m => m.GroupName, new { @Readonly = "true" })
                }
                @Html.ValidationMessageFor(sysConfig => sysConfig.GroupName)
            </p>
            <p>
                <label>
                    标题：
                </label>
                @Html.TextBoxFor(m => m.DecValue)
                @Html.ValidationMessageFor(m => m.DecValue)
            </p>
            <p>
                <label>
                    是否系统：
                </label>
                @Html.CheckBox("ckIsSys", Model.IsSys, new { disabled = "true" })
                @Html.HiddenFor(m => m.IsSys, new { disabled = "true" })
                @Html.ValidationMessageFor(m => m.IsSys)
            </p>
            @Html.Partial("Operation", Model)
        </div>
        <div class="MyPanel">
            <b class="b1"></b><b class="b2 d1"></b><b class="b3 d1"></b><b class="b4 d1"></b>
            <div class="b d1 k">
                <div class="Content">
                    <div >
                        <table class="list nowrap itemDetail" id="tabDocsDetails" addbutton="新增" width="100%" isrownum="false" layouth="240">
                            <thead>
                                <tr>
                                    <th type="label" defaultVal="#index#">序号</th>
                                    <th type="text" name="SubDics[#index#].DecKey" size="12" fieldclass="required IsExisted" targeter="GroupName" ajax="System/SysDictionary/IsExist">健</th>
                                    <th type="text" name="SubDics[#index#].DecValue" size="12" fieldclass="required">值</th>
                                    <th type="text" name="SubDics[#index#].DecOrder" size="12" fieldclass="required digits">排序</th>
                                    <th type="del" width="20" ></th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var item in subSysDics)
                                {
                                    <tr target="ConsignCus_DetailsGUID" rel="@i">
                                        <td>@(i+1)</td>
                                        <td>
                                            @if (string.IsNullOrEmpty(item.DecKey))
                                            {
                                                @Html.TextBox("SubDics[" + i + "].DecKey", item.DecKey, new { @class = "required", tabindex = tab + i + j })}
                                            else
                                            {
                                                @Html.TextBox("SubDics[" + i + "].DecKey", item.DecKey, new { @class = "required", @Readonly = "true", tabindex = tab + i + j })
                                            }
                                        </td>
                                        <td>
                                            @{j += 1;}
                                            @Html.TextBox("SubDics[" + i + "].DecValue", item.DecValue, new { @class = "required", tabindex = tab + i + j })
                                            @Html.Hidden("SubDics[" + i + "].GKey", item.GKey)
                                            @Html.Hidden("SubDics[" + i + "].GroupName", item.GroupName)
                                        </td>
                                        <td>
                                            @{j += 1;}
                                            @Html.TextBox("SubDics[" + i + "].DecOrder", item.DecOrder, new { @class = "digits", tabindex = tab + i + j })
                                        </td>
                                        <td><a href="System/SysDictionary/Delete/@item.GroupName/@item.DecKey" class="btnDel">删除</a></td>
                                    </tr>
                                                    i += 1;
                                                    j += 1;
                                                }

                            </tbody>
                        </table>

                    </div>
                </div>
            </div>
            <b class="b4b d1"></b><b class="b3b d1"></b><b class="b2b d1"></b><b class="b1b"></b>
        </div>
        @Html.Partial("FormButtonBar")
    </form>
</div>